package eiisan.function;

import java.util.*;

/**
 * @author gragonfly
 * @date 2019/7/27
 **/
public class StringComparator {
    public static void main(String[] args) {
        List<String> names = Arrays.asList("zhangsan", "lisi", "wangwu", "zhangmazi");
//        Collections.sort(names, new Comparator<String>() {
//            @Override
//            public int compare(String o1, String o2) {
//                return o1.compareTo(o2);
//            }
//        });
//        System.out.println(names);

        Collections.sort(names, (o1, o2) -> o1.compareTo(o2));
        System.out.println(names);
    }
}
